SELECT
<#assign prefixName=' '>
<#if (select__id??)>
${prefixName} T.ID AS id
	<#assign prefixName=','>
</#if>
<#if (select__endDaTi??)>
${prefixName} T.END_DA_TI AS endDaTi
	<#assign prefixName=','>
</#if>
<#if (select__idTrCo??)>
${prefixName} T.ID_TR_CO AS idTrCo
	<#assign prefixName=','>
</#if>
<#if (select__nameTrCo??)>
${prefixName} T.NAME_TR_CO AS nameTrCo
	<#assign prefixName=','>
</#if>
<#if (select__name??)>
${prefixName} T.NAME AS name
	<#assign prefixName=','>
</#if>
<#if (select__codeTrCo??)>
${prefixName} T.CODE_TR_CO AS codeTrCo
	<#assign prefixName=','>
</#if>
<#if (select__entityId??)>
${prefixName} T.ENTITY_ID AS entityId
	<#assign prefixName=','>
</#if>
<#if (select__beginDaTi??)>
${prefixName} T.BEGIN_DA_TI AS beginDaTi
	<#assign prefixName=','>
</#if>
<#if (select__code??)>
${prefixName} T.CODE AS code
	<#assign prefixName=','>
</#if>
<#if (select__numberTrCo??)>
${prefixName} T.NUMBER_TR_CO AS numberTrCo
	<#assign prefixName=','>
</#if>
<#if prefixName == ' '>
  T.ID AS id
, T.END_DA_TI AS endDaTi
, T.ID_TR_CO AS idTrCo
, T.NAME_TR_CO AS nameTrCo
, T.NAME AS name
, T.CODE_TR_CO AS codeTrCo
, T.ENTITY_ID AS entityId
, T.BEGIN_DA_TI AS beginDaTi
, T.CODE AS code
, T.NUMBER_TR_CO AS numberTrCo
</#if>
FROM FD_DEPARTMENT_CU_IN_EF T
<#include "whereDepartmentCuInEfBy1.ftl">
<#assign prefixName='ORDER BY'>
<#if (order__by__id??)>
${prefixName} T.ID ${order__by__id__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__endDaTi??)>
${prefixName} T.END_DA_TI ${order__by__endDaTi__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__idTrCo??)>
${prefixName} T.ID_TR_CO ${order__by__idTrCo__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__nameTrCo??)>
${prefixName} T.NAME_TR_CO ${order__by__nameTrCo__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__name??)>
${prefixName} T.NAME ${order__by__name__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__codeTrCo??)>
${prefixName} T.CODE_TR_CO ${order__by__codeTrCo__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__entityId??)>
${prefixName} T.ENTITY_ID ${order__by__entityId__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__beginDaTi??)>
${prefixName} T.BEGIN_DA_TI ${order__by__beginDaTi__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__code??)>
${prefixName} T.CODE ${order__by__code__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__numberTrCo??)>
${prefixName} T.NUMBER_TR_CO ${order__by__numberTrCo__value!}
	<#assign prefixName=','>
</#if>
